Kpathsea library

for version 2.6

January 1995

Karl Berry

Copyright © 1993, 94 Karl Berry.

Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.

Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided also that the sections entitled “Regain your programming freedom” and “GNU General Public License” are included exactly as in the original, and provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.

Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions, except that the sections entitled “Regain your programming freedom” and “GNU General Public License” may be included in a translation approved by the Free Software Foundation instead of in the original English.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1 Introduction

This manual corresponds to version 2.6 of the Kpathsea library, released in January 1995.

The library’s fundamental purpose is to look up a file in a list of directories specified by the user, similar to what shells do when looking up program names to execute.

The following software, all of which I maintain, uses this library:

The library is still under development (and probably always will be, despite my hopes). I do not promise to keep the interface unchanged. If you have comments or suggestions, please send them to me (see section Reporting bugs).

Currently, I distribute the library under the GNU General Public License (@pxref{Copying}). In short, this means if you write a program using the library, you must (offer to) distribute the source, and allow anyone to modify the source and distribute their modifications.

If you have a problem with this, contact me. I would consider putting the library under the GNU Library General Public License, which would permit you to distribute the source only to the library, not to your program using it. But I will only do this if someone actually says they will not use the library under the GPL conditions, and would use it under the LGPL.

If you know enough about TeX to be reading this manual, then you (or perhaps your institution) should consider joining the TeX Users Group (if you’re already a member, great!). TUG produces a periodical called TUGboat, sponsors an annual meeting (the proceedings of which are published in TUGboat), and arranges courses on TeX for all levels of users. Given sufficient funding (which your joining will help) TUG could sponsor more projects that will benefit the TeX community, such as a successor to TeX . Anyway, here is the address:

TeX Users Group
P.O. Box 869
Santa Barbara, CA 93102 USA
phone: (805) 899-4673
email: ‘tug@tug.org

[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.1 History

(This section is for those people who are curious about how this came about.) (If you like to read historical accounts of software, I urge you to seek out the GNU Autoconf manual and, even more fun, the “Errors of TeX” paper that Don Knuth published in Software—Practice and Experience.)

My first ChangeLog entry for Web2c seems to be February 1990, but I may have done some stuff before then. In any case, Tim Morgan and I were sort of jointly maintaining it for a time. (I should say that Tim had made Web2c into a real distribution long before I had ever used it or even heard of it, and Tom Rokicki did the original implementation.)

It must have been later in 1990 and 1991 that I started working on TeX for the Impatient and Dvips, Xdvi, Web2c, and the GNU fontutils (which I was also writing at the time) using different environment variables, and, even more importantly, having different bugs in their path searching became extremely painful. I also desperately wanted to implement subdirectory searching, since I couldn’t stand putting everything in one big directory, and also couldn’t stand having to explicitly specify ‘pandora’, ‘cm’ in a path.

In the first incarnation, I just hacked separately on each program— that was the original subdirectory searching code in both Xdvi and Dvips, though I think Paul Vojta has completely rewritten Xdvi’s support by now. That is, I tried to go with the flow in each program, rather than changing the program’s calling sequences to conform to common routines.

Then, as bugs inevitably appeared, I found I was fixing the same thing in each of three (Web2c and fontutils were always sharing code, since I maintained those—there was no Dvipsk or Xdvik or Dviljk at this point). After a while, I finally started sharing source files. They weren’t a library, though. I just kept things up to date with shell scripts. (I was developing on a 386 running ISC 2.2 at the time, and so didn’t have symbolic links. An awful experience.)

Things kept on like this for quite a while. The ‘ChangeLog’s for Xdvik and Dvipsk record initial releases of those distributions in May and June 1992. I think it was because I was tired of the different configuration strategies of each program, not so much because of the path searching. (Autoconf was being developed by David MacKenzie and others, and I was adapting it to TeX and friends.)

I starting to make it a separate library that other programs could link with on my birthday in April 1993, according to the ChangeLog. I don’t remember exactly why I finally took the time to make it a separate library; I think it was a conversation with david zuhn that led to doing it. Just seemed like it was time.

Dviljk got started in March 1994 after I bought a Laserjet 4. (Kpathsea work got suspended while Norm Walsh and I, with Gustaf Neumann’s help, implemented a way for TeX to get at all those neat builtin LJ4 fonts ... such a treat to have something to typeset in besides Palatino!)

At this point (October 1994), I’ve implemented just about all the path-searching features in Kpathsea that I ever intended to (and some I didn’t intend …). After the next stable release of Web2c, I figure I’ll be able to stop development, and turn most of my attention back to making fonts for GNU. (Always assuming Microsoft hasn’t completely obliterated Unix by then, or that software patents haven’t stopped software development by anybody smaller than a company with a million-dollar-a-year legal budget. Which is actually what I think is likely to happen, but that’s another story…)


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2 Installation

Here are the basic steps for configuration and installation:

  1. make install. This installs the library, header files, and documentation. Or make install-data to just install the architecture-independent files. Or make install-exec to just install the (binary) archive library file.

    Since I only distribute Kpathsea as part of another package, you will probably be doing the above in a top-level directory that contains a ‘Makefile’, ‘kpathsea’, and the other package. But you can do the installation in ‘kpathsea’ itself, if you only want to install the library, not the other package.

  2. The first time you install any manual in Info, you have to add a line (you choose where) to the ‘dir’ file in your ‘$(infodir)’ directory. A sample line to add is given near the top of the Texinfo source files (‘kpathsea/kpathsea.texi’ and ‘dvipsk/dvips.texi’).
  3. make distclean. This removes all files created by the build.

See section Filename database (ls-R), for a description of an externally-generated database that can help speed searches.

See section Debugging, for runtime debugging support that may help track down problems.

Do not attempt to use any version of Kpathsea with any program except the version that the program came with, unless you are a glutton for punishment.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.1 Default paths

To summarize the chain of events that go into defining the default paths:

  1. configure’ creates a ‘Makefile’ from each ‘Makefile.in’.
  2. When Make runs in the ‘kpathsea’ directory, it creates a file ‘texmf.sed’ that substitutes the Make value of $(var) for a string @var@. The variables in question are the one that define the installation directories.
  3. texmf.sed’ (and a little extra magic—see ‘kpathsea/Makefile’) is applied to ‘texmf.cnf.in’ to generate ‘texmf.cnf’. This is the file that will eventually be installed and used by the programs to look up programs.
  4. The definitions in ‘texmf.cnf’ are changed into the form of C ‘#define’’s, producing ‘paths.h’. These values will be the compile-time defaults; they are not used unless no ‘texmf.cnf’ file can be found at runtime.

    (That’s a partial lie: the compile-time defaults are what extra ‘:’’s in ‘texmf.cnf’ expand into; but the paths as distributed have no extra ‘:’’s, and there’s no particular reason for them to.)

The purpose of this elaborate sequence is to avoid having the same information in more than one place. If you change the installation directories or top-level prefix before running ‘configure’, those changes will propagate through the whole sequence. If you change the default paths in ‘texmf.cnf.in’, those changes are propagated to the compile-time defaults.

Alternatively, you can ignore the whole mess and edit ‘texmf.cnf’ after it is installed. Maybe even copying it into place beforehand so you can complete the installation, if TeX or Metafont is having trouble finding their input files.

Unfortunately, editing ‘Makefile.indoes not work in one common case—changing the prefix or exec_prefix variables. For these, you must use the ‘-prefix’ or ‘-exec-prefix’ options to configure. See Running configure scripts in Autoconf. (That’s another partial lie: editing does work, as long as a program named tex is not in your PATH.)

See section TeX directory structure, for a description of some ways to arrange the TeX library files, and some features of the distributed paths that may not be obvious. The file ‘kpathsea/HIER’ is a copy of that section.

The Make definitions are all repeated in several ‘Makefile’’s; but changing the top-level ‘Makefile’ should suffice, as it passes down all the variable definitions, thus overriding the submakes. (The definitions are repeated so you can potentially run Make in the subdirectories.)


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.2 Common problems

Some common problems with compilation, linking, or execution are described below.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.2.1 Unable to find files

If a program complains it cannot find fonts (or other input files), any of several things might be wrong:

In any case, you may find the debugging options helpful in determining precisely where the fonts (or whatever) are being looked for. See the program’s documentation for its debugging options, and also see section Debugging.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.2.2 Slow path searching

If your program takes an excessively long time to find fonts or other input files, but does eventually succeed, here are some possible culprits:

In any case, you may find the debugging options helpful in determining precisely when the disk or network is being pounded. See section Debugging, and also see the program’s documentation.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.2.3 XtInherit

On DEC OSF/1 1.x systems, the loader has a bug that manifests itself in the following error (all on one line, but for the sake of the paper width it’s broken here):

xdvik/xdvi: /sbin/loader: Fatal Error: search_for_undefineds: 
     symbol _XtInherit should not have any relocation entry

According to Michael Rickabaugh ‘<mjr@quarry.enet.dec.com>’:

This is a bug fixed in DEC OSF/1 2.0.

If you know how, installing ‘/sbin/loader’ from a 2.0 system onto a
1.3 system will work.  Make sure that ‘/usr’ is not mounted
when you do this.  (If you forget about umounting /usr, it is
possible most of your filesystems will become corrupted.)

Otherwise, I suggest getting a hold of a 2.0 CD and running
‘/usr/sbin/installupdate’.

Alternatively, you may be able to use the freely available X11 libraries that come with the MIT distribution (on ‘ftp.x.org’, for example).

Linking statically, perhaps only with some of the X libraries, may also work. (if you find the definitive workaround, please let me know.)


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.2.4 wchar_t

The upshot of all the following is that if you get error messages regarding wchar_t, try defining NO_FOIL_X_WCHAR_T (for Web2c) or FOIL_X_WCHAR_T (for everything else).

wchar_t has caused infinite trouble. None of my code ever uses wchar_t; all I want to do is include X header files and various system header files, possibly compiling with GCC. This seems an impossible task!

The X11 header ‘<Xlib.h>’ and GCC’s ‘<stddef.h>’ have conflicting definitions for wchar_t.

The particulars: ‘<X11/Xlib.h>’ from MIT X11R5 defines wchar_t if X_WCHAR is defined, which is defined if X_NOT_STDC_ENV is defined, and we define that if STDC_HEADERS is not defined (‘configure’ decides if STDC_HEADERS gets defined). But when compiling with gcc on SunOS 4.1.x, STDC_HEADERS is not defined (‘string.h’ doesn’t declare the ‘mem’* functions), so we do get X’s wchar_t—and we also get gcc’s wchar_t from its ‘<stddef.h>’. Conflict.

On the other hand, SunOS 4.1.1 with some other X configurations actually needs GCC to define wchar_t, and fails otherwise.

My current theory is to define wchar_t to a nonsense symbol before the X include files are read; that way its definition (if any) will be ignored by other system include files. Going along with that, define X_WCHAR to tell X not to use ‘<stddef.h>’, that we’ve already included, but instead to make its own definition.

But this is not the end of the story. The X11 include files distributed with DG/UX 5.4.2 for the Aviion have been modified to include ‘<_int_wchar_t.h>’ if X_WCHAR, so our #define will not have any typedef to change—but the uses of wchar_t in the X include files will be changed to reference this undefined symbol. So there’s nothing to foil in this case. I don’t know how to detect this automatically, so it’s up to you to define NO_FOIL_X_WCHAR_T yourself.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.2.5 ShellWidgetClass

This section is adapted from question 47 from the ‘comp.sys.sun.admin’ FAQ.

If you are linking with Sun’s OpenWindows libraries in SunOS 4.1.x, you may get undefined symbols _get_wmShellWidgetClass and _get_applicationShellWidgetClass. This problem does not arise with the standard MIT libraries under SunOS.

The cause is bugs in the Xmu shared library as shipped from Sun. There are several fixes:

Here is the information for getting the two patches:

Patch ID: 100512-02
Bug ID’s: 1086793, 1086912, 1074766
Description: 4.1.x OpenWindows 3.0 libXt jumbo patch

Patch ID: 100573-03
Bug ID: 1087332
Description: 4.1.x OpenWindows 3.0 undefined symbols when using shared
libXmu.

The way to statically link with libXmu depends on whether you are using a Sun compiler (e.g., cc) or gcc. If the format, alter the x_libs make variable to include

-Bstatic -lXmu -Bdynamic

If you are using gcc, include ‘-static’ in ‘LDFLAGS’; this will link all libraries statically. If you want to link only Xmu statically and everything else dynamically, you have to do it by hand: run gcc -v, grab the ld line, and add the ‘-B’’s given above around -lXmu.

The reason is that gcc moves all linker options to the front of the ld command line. So you can’t specify different options for different libraries. When I reported this to the GCC maintainers, the reply was that they would happily merge in the changes, but they didn’t want to take the time to do it themselves.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.2.6 Pointer combination warnings

When compiling with old C compilers, you may get some warnings about “illegal pointer combinations”. These are spurious; just ignore them. I decline to clutter up the source with casts to get rid of them.

In general, if you have trouble with a system C compiler, I advise trying the GNU C compiler. (And vice versa, unfortunately; but in that case I also recommend reporting a bug to the GCC bug list.)


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3 Shared library

You can compile Kpathsea as a shared library. The advantage in doing this is that the different executables can then share the code, decreasing memory usage. (The other advantage in general of shared libraries is that it’s possible to update the library and programs independently. But since the Kpathsea interface is not and can not be frozen, that doesn’t apply here.)

Under Solaris, use ‘-K pic -xstrconst’ if you compile with a Sun compiler, ‘-fpic’ if you use GCC. Also add ‘-L$(libdir) -R$(libdir)’ to ‘LDFLAGS’ when you link the binaries, so that the library can be found, and users do not have set ‘LD_LIBRARY_PATH’.

(If you know how to make Kpathsea shared on other systems, please send a message to the bug address in the next section.)


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.4 Reporting bugs

If you encounter problems, please report them to ‘tex-k@cs.umb.edu’. Include the version number of the library, the system you are using, and enough information to reproduce the bug in your report. To get on this mailing list yourself, email ‘tex-k-request@cs.umb.edu’ with a message whose body contains a line

subscribe you@your.preferred.address

To avoid wasted effort and time (both mine and yours), I strongly advise applying the principles given in the GNU C manual (see Reporting Bugs in The GNU CC manual) to your bug reports.

Please also report bugs in this documentation—not only factual errors, but unclear explanations, typos, wrong fonts, …


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3 Debugging

Kpathsea provides a number of runtime debugging options, detailed below by their names (and corresponding numeric values). You can set these with some runtime argument (e.g., ‘-d’) to the program; in that case, you should use the numeric values described in the program’s documentation (which, except for Dviljk, are different from those below).

You can also set the environment variable KPATHSEA_DEBUG. In this case, you should use the numbers below. Also use the numbers below if you run the program under a debugger and set the the variable ‘kpathsea_debug’ yourself.

In any case, you can not use the names below; you must always use somebody’s numbers. (Sorry.) And to set more than option, just sum the corresponding numbers.

KPSE_DEBUG_STAT

(1). Reports ‘stat’(2) calls. This is useful for verifying that your directory structure is not forcing Kpathsea to do many additional file tests (see section Slow path searching and see section Subdirectory expansion). If you are using an up-to-date ‘ls-R’ database (see section Filename database (ls-R)), this should produce no output unless a nonexistent file is searched for.

KPSE_DEBUG_HASH

(2). Reports lookups in all hash tables, including ‘ls-R’ (see section Filename database (ls-R)), font aliases (see section Fontmap), and config file values (see section Config files). Useful when expected values are not being found, e.g.., file searches are looking at the disk instead of using ‘ls-R’.

KPSE_DEBUG_FOPEN

(4). Reports file openings and closings. Especially useful when your system’s file table is full, for seeing if some files have been opened but never closed. In case you want to set breakpoints: this works by redefining ‘fopen’ (‘fclose’) to be ‘kpse_fopen_trace’ (‘kpse_fclose_trace’).

KPSE_DEBUG_PATHS

(8). Reports general path information for each file type Kpathsea is asked to search. This is useful when you are trying to track down how a particular path got defined—from ‘texmf.cnf’, ‘config.ps’, the compile-time default, an environment variable, etc. This is the contents of a structure defined in ‘tex-file.h’.

KPSE_DEBUG_EXPAND

(16). Reports the directory list corresponding to each path element Kpathsea searches in. This is only relevant when Kpathsea is searching the disk, since ‘ls-R’ searches don’t look through directory lists in this way (they go straight to the file using the hash table).

KPSE_DEBUG_SEARCH

(32). Reports on each file search Kpathsea attempts: the name of the file searched for, the path searched in, whether or not the file must exist (when drivers search for ‘cmr10.vf’, it need not exist), and whether or not we are collecting all occurrences of the file in the path (as with, e.g., ‘texmf.cnf’ and ‘texfonts.map’), or just the first (as with most lookups). This can help you correlate what Kpathsea is doing with what is in your input file.

Debugging output from Kpathsea is always written to standard error, and begins with ‘kdebug:’. (Except for hash table buckets, which just start with the number.)


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.1 Logging

Kpathsea can record the time and filename found for each successful search. This may be useful in finding good candidates for deletion when your disk is full.

To do this, define the environment or config file variable TEXMFLOG. The value is the name of the file to append the information to. The file is created if it doesn’t exist.

Each successful search turns into one line in the log file, with two words separated by a space. The first word is the time of the search, as the integer number of seconds since “the epoch”, i.e., UTC midnight 1 January 1970 (more precisely, the result of the time system call). The second word is the filename.

For example, after setenv TEXMFLOG /tmp/log, running Dvips on ‘story.dvi’ appends the following lines:

774455887 /usr/local/lib/texmf/dvips/config.ps
774455887 /usr/local/lib/texmf/dvips/psfonts.map
774455888 /usr/local/lib/texmf/dvips/texc.pro
774455888 /usr/local/lib/texmf/fonts/public/cm/pk/ljfour/cmbx10.600pk
774455889 /usr/local/lib/texmf/fonts/public/cm/pk/ljfour/cmsl10.600pk
774455889 /usr/local/lib/texmf/fonts/public/cm/pk/ljfour/cmr10.600pk
774455889 /usr/local/lib/texmf/dvips/texc.pro

Only filenames that are absolute are recorded, to preserve some semblance of privacy.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4 Path searching

This chapter describes the generic path searching mechanism Kpathsea provides. For information about searching for particular file types (e.g., TeX fonts), see the next chapter.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.1 Searching overview

A search path is a colon-separated list of path elements, which are directory names with some extra frills. A search path can come from (a combination of) many sources; see below. To look up a file ‘foo’ along a path ‘.:/dir’, Kpathsea checks each element of the path in turn: first ‘./foo’, then ‘/dir/foo’, (typically) returning the first one that exists.

The “colon” and “slash” mentioned here aren’t necessarily ‘:’ and ‘/’ on non-Unix systems. Kpathsea tries to adapt to other operating systems’ conventions.

To check a path element e, Kpathsea first sees if a prebuilt database (see below) applies to e, i.e., if the database is in a directory that is a prefix of e. If so, the path specification is matched against the contents of the database.

If the database does not exist, or does not apply to this path element, contains no matches, the filesystem is searched. Kpathsea constructs the list of directories that correspond to this path element, and then checks in them for the file being searched for. (To help speed future lookups of files in the same directory, the directory in which a file is found is floated to the top of the directory list.)

Each path element is checked in turn: first the database, then the disk. Once a match is found, the searching stops and the result is returned. This avoids possibly-expensive processing of path specifications that are never needed on a particular run.

Although the simplest and most common path element is a directory name, Kpathsea supports additional features in search paths: layers of default values, environment variable names, config file values, users’ home directories, and recursive subdirectory searching. Thus, we say that Kpathsea expands a path element, meaning getting rid of all the magic specifications and getting down to the basic directory name or names. This process is described in the sections below. It happens in the same order as the sections.

Exception to the above: If the filename being searched for is absolute or explicitly relative, i.e., starts with ‘/’ or ‘./’ or ‘../’, Kpathsea simply checks if that file exists; it is not looked for along any paths.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.2 Path sources

A search path can come from many sources. In priority order (meaning Kpathsea will use whichever it finds first):

  1. A user-set environment variable, e.g., ‘TEXINPUTS’.
  2. A program-specific configuration file, e.g., an ‘S /a:/b’ line in Dvips’ ‘config.ps’.
  3. A line in a Kpathsea configuration file ‘texmf.cnf’, e.g., ‘TEXINPUTS=/c:/d’. See section below.
  4. The compile-time default (specified in ‘kpathsea/paths.h’).

In any case, once the path specification to use is determined, its evaluation is independent of its source. These sources may also be combined via default expansion. See the next section.

You can see each of these values for a given search path by using the debugging options of Kpathsea or your program. See section Debugging.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.2.1 Config files

As mentioned above, Kpathsea reads runtime configuration files named ‘texmf.cnf’ for search path definitions. The path used to search for them is constructed in the usual way, as described above (except that configuration files cannot be used to define the path, naturally; also, an ‘ls-R’ database is not used to search for them, for technical reasons).

The environment variable used is ‘TEXMFCNF’.

Kpathsea reads alltexmf.cnf’ files in the search path, not just the first one found; it uses the first definition of each variable encountered. Thus, with the (default) search path of ‘.:$TEXMF’, values from ‘./texmf.cnf’ override those from ‘$TEXMF/texmf.cnf’.

Here is the format for ‘texmf.cnf’ files:

Here is the fragment from the distributed file illustrating most of these points:

% TeX input files -- i.e., anything to be found by \input or \openin [...]
latex209_inputs = .:$TEXMF/tex/latex209//:$TEXMF/tex//
latex2e_inputs = .:$TEXMF/tex/latex2e//:$TEXMF/tex//
TEXINPUTS = .:$TEXMF/tex//
TEXINPUTS.latex209 = $latex209_inputs
TEXINPUTS.latex2e = $latex2e_inputs
TEXINPUTS.latex = $latex2e_inputs

Although this format has obvious similarities to Bourne shell scripts—change the comment character to #, disallow spaces around the =, and get rid of the .program convention, and it could be run through the shell. But there seemed little advantage to doing this, since all the information would have to passed back (with echo’s, presumably) to Kpathsea and parsed there anyway, since the sh process couldn’t affect its parent’s environment.

The implementation of all this is in ‘kpathsea/cnf.c’.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.3 Default expansion

If the highest-priority search path (in the list in the previous section) contains an extra colon (i.e., leading, trailing, or doubled), Kpathsea inserts the next-highest-priority search path that is set at that point. If that search path has an extra colon, the same happens with the next-highest. (An extra colon in the compile-time default value has unpredictable results, and may cause the program to crash, so installers beware.)

For example, given

setenv TEXINPUTS /home/karl:

and a ‘TEXINPUTS’ value from ‘texmf.cnf’ of

.:$TEXMF//tex

then the final value used for searching will be:

/home/karl:.:$TEXMF//tex

You can trace this by debugging “paths” (see section Debugging).

Minor technical point: Since it would be useless to insert the default value in more than one place, Kpathsea changes only one extra ‘:’ and leaves any others in place (where they will eventually be effectively equivalent to ‘.’, i.e., the current directory). It checks first for a leading ‘:’, then a trailing ‘:’, then a doubled ‘:’.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.4 Variable expansion

$foo’ or ‘${foo}’ in a path element is replaced by (1) the value of an environment variable ‘foo’ (if it is set); (2) the value of ‘foo’ from ‘texmf.cnf’ (if any such exists); (3) the empty string.

If the character after the ‘$’ is alphanumeric or ‘_’, the variable name consists of all consecutive such characters. If the character after the ‘$’ is a ‘{’, the variable name consists of everything up to the next ‘}’ (braces are not balanced!). Otherwise, Kpathsea gives a warning and ignores the ‘$’ and its following character.

Remember to quote the ‘$’’s and braces as necessary for your shell.

Shell variable values cannot be seen by Kpathsea.

For example, given

setenv TEXMF /home/tex
setenv TEXINPUTS .:$TEXMF:${TEXMF}new

the final ‘TEXINPUTS’ path is the three directories:

.:/home/tex:/home/texnew

You can trace this by debugging “paths” (see section Debugging).


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.5 Tilde expansion

A leading ‘~’ or ‘~user’ in a path element is replaced by the current or user’s home directory, respectively.

If user is invalid, or the home directory cannot be determined, Kpathsea uses ‘.’ instead.

For example,

setenv TEXINPUTS ~/mymacros:

will prepend a directory ‘mymacros’ in your home directory to the default path.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.6 Subdirectory expansion

A ‘//’ in a path element following a directory d is replaced by all subdirectories of d: first those subdirectories directly under d, then the subsubdirectories under those, and so on. At each level, the order in which the directories are searched is unspecified. (It’s “directory order”, and definitely not alphabetical.)

If you specify any filename components after the ‘//’, only subdirectories which contain those components are included. For example, ‘/a//b’ would expand into directories ‘/a/1/b’, ‘/a/2/b’, ‘/a/1/1/b’, and so on, but not ‘/a/b/c’ or ‘/a/1’.

I should mention one related implementation trick, which I stole from GNU find. Matthew Farwell ‘<dylan@ibmpcug.co.uk>’ suggested it, and David MacKenzie ‘<djm@gnu.ai.mit.edu>’ implemented it (as far as I know).

The trick is that in every real Unix implementation (as opposed to the POSIX specification), a directory which contains no subdirectories will have exactly two links (namely, one for ‘.’ and one for ‘..’). That is to say, the st_nlink field in the ‘stat’ structure will be two. Thus, we don’t have to stat everything in the bottom-level (leaf) directories—we can just check st_nlink, notice it’s two, and do no more work.

But if you have a directory that contains one subdirectory and five hundred files, st_nlink will be 3, and Kpathsea has to stat every one of those 501 entries. Therein lies slowness.

You can disable the trick by undefining UNIX_ST_LINK in ‘kpathsea/config.h’. (It is undefined by default except under Unix.)

Unfortunately, in some cases files in leaf directories are stat’d: if the path specification is, say, ‘$TEXMF/fonts//pk//’, then files in a subdirectory ‘…/pk’, even if it is a leaf, are checked. The reason cannot be explained without reference to the implementation, so read ‘kpathsea/elt-dirs.c’ (search for ‘may descend’) if you are curious. (And if you can find a way to solve the problem, please let me know.)


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.7 Filename database (ls-R)

Kpathsea goes to some lengths to minimize disk accesses for searches (see section Subdirectory expansion). Nevertheless, at installations with enough directories, doing a linear search of each possible directory for a given file can take an excessively long time (“excessive” depending on the speed of the disk, whether it’s NFS-mounted, how patient you are, etc.). In practice, the union of font directories from the Dvips(k) and Dviljk distributions is large enough for searching to be noticeably slow on typical machines these days.

Therefore, Kpathsea can use an externally-built “database” that maps files to directories, thus avoiding the need to exhaustively search the disk. By fiat, you must name the file ‘ls-R’, and put it at the root of the TeX installation hierarchy (‘$TEXMF’ by default). Kpathsea does variable expansion on the ‘$TEXMF’, naturally, so you can use different ‘ls-R’’s for different trees, if you are testing new ones. However, one and only one ‘ls-R’ is read; it is not searched for along any paths.

You can build ‘ls-R’ with the command

ls -R /your/root/dir >ls-R

if your ls produces the right output format (see the section below). GNU ls, for example, outputs in this format. It is probably best to do this via cron, so changes in the installed files will be automatically reflected (albeit with some delay) in the database.

If your system uses symbolic links, the command ls -LR will be more reliable than plain ls -R. The former follows the symbolic links to the real files, which is what Kpathsea needs.

Kpathsea warns you if it finds an ‘ls-R’ file, but the file does not contain any usable entries. The usual culprit is using just ls -R to generate the ‘ls-R’ file instead of ls -R /your/dir. Kpathsea looks for lines starting with ‘/’, to improve reliability with unusual filenames (specifically, those ending with a ‘:’).

Because the database may be out-of-date for a particular run (e.g., if a font was just built with MakeTeXPK), if a file is not found in the database, by default Kpathsea goes ahead and searches the disk. If a particular path element begins with ‘!!’, however, only the database will be searched for that element, never the disk. If the database does not exist, nothing will be searched. Because this can greatly surprise users (“I see the font ‘foo.tfm’ when I do an ls; why can’t Dvips find it?”), I do not recommend using this feature.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.7.1 Database format

The “database” read by Kpathsea is a line-oriented file of plain text. The format is that generated by GNU (and perhaps other) ls programs given the ‘-R’ option, as follows.

For example, here’s the first few lines of ‘ls-R’ on my system:

bibtex
dvips
fonts
ini
ls-R
mf
tex

/usr/local/lib/texmf/bibtex:
bib
bst
doc

/usr/local/lib/texmf/bibtex/bib:
asi.bib
bibshare
btxdoc.bib

On my system, ‘ls-R’ is about 30K bytes.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5 TeX searching

Although the basic features in Kpathsea can be used for any type of path searching, it came about (like all libraries) with a specific application in mind: I wrote Kpathsea specifically for TeX system programs. I had been struggling with the programs I was using (Dvips, Xdvi, and TeX itself) having slightly different notions of how to specify paths; and debugging was painful, since no code was shared.

Therefore, Kpathsea provides some TeX-specific features. Indeed, many of the supposedly generic path searching features were provided because they seemed useful in that conTeXt (font lookup, particularly).


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.1 TeX environment variables

Kpathsea defines a sequence of environment variables to search for each file type it supports. This makes it easy for different programs to check the same environment variables, in the same order.

The following table lists the environment variables searched for each file type in the order they are searched (and a brief description of the file type). That is, only if the first variable is unset is the second variable checked, and so on. If none are set, various other things are checked; see section Path sources.

.base

(Metafont memory dump) ‘MFBASES

.bib

(BibTeX bibliography source) ‘BIBINPUTS

.bst

(BibTeX style file) ‘BSTINPUTS’, ‘TEXINPUTS

.cnf

(Kpathsea runtime configuration files) ‘TEXMFCNF

.eps

(Encapsulated PostScript figures) ‘TEXPICTS’, ‘TEXINPUTS

.fmt

(TeX memory dump) ‘TEXFORMATS

gf

(generic font bitmap) ‘programFONTS’, ‘GFFONTS’, ‘GLYPHFONTS’, ‘TEXFONTS

.mf

(Metafont source) ‘MFINPUTS

mf.pool

(Metafont program strings) ‘MFPOOL

.pict

(Other kinds of figures) Same as ‘.eps’.

pk

(packed bitmap font) ‘programFONTS’, ‘PKFONTS’, ‘TEXPKS’, ‘GLYPHFONTS’, ‘TEXFONTS

.tex

(TeX source) ‘TEXINPUTS

tex.pool

(TeX program strings) ‘TEXPOOL

.tfm

(TeX font metrics) ‘TFMFONTS’, ‘TEXFONTS

.vf

(virtual font) ‘VFFONTS’, ‘TEXFONTS

For the font variables, the intent is that:

  1. TEXFONTS’ is the default for everything.
  2. GLYPHFONTS’ is the default for bitmap (or, more precisely, non-metric) files.
  3. Each format has its own variable.
  4. Each program can and should have its own font override path as well; e.g., ‘DVIPSFONTS’ for Dvipsk. Again, this is for bitmaps, not metrics.

If these environment variables are set, the corresponding ‘texmf.cnf’ definition won’t be looked at (unless, as usual, the environment variable has an extra ‘:’). See section Default expansion.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.2 Glyph lookup

Kpathsea provides a routine (kpse_find_glyph_format in ‘kpathsea/tex-glyph.c’) which searches for a bitmap font in GF or PK format (or either) given a font name (e.g., ‘cmr10’) and a resolution (e.g., 300).

The search is based solely on filenames, not file contents—if a PK file is named ‘cmr10.300gf’, it will be found as a GF file.

Here is an outline of the search strategy (details in the sections below) for a file name at resolution dpi. The search stops at the first successful lookup.

  1. Look for an existing file name.dpi in the specified format(s).
  2. If name is an alias for a file f in the fontmap file ‘texfonts.map’, look for f.dpi.
  3. Run an external script (typically named MakeTeXPK) to generate the font.
  4. Look for fallback.dpi, where fallback is some last-resort font (typically ‘cmr10’).

[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.2.1 Basic glyph lookup

When Kpathsea looks for a bitmap font name at resolution dpi in a format format, it first checks each directory in the search path for a file ‘name.dpiformat’; for example, ‘cmr10.300pk’. Kpathsea looks for a PK file first, then a GF file.

If that fails, Kpathsea looks for ‘dpidpi/name.format’; for example, ‘dpi300/cmr10.pk’. This is how fonts are typically stored on filesystems (like DOS’s) that permit only three-character extensions.

If that fails, Kpathsea looks for a font with a close-enough dpi. “Close enough” is defined (by the macro KPSE_BITMAP_TOLERANCE in ‘kpathsea/tex-glyph.h’) to be dpi / 500 + 1, which is slightly more than the 0.2% allowed by the DVI standard.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.2.2 Fontmap

If a bitmap font is not found with the original name (see the previous section), Kpathsea looks through any fontmap files for an alias for the original font name. These files are named ‘texfonts.map’ and are searched for along the usual glyph path.

This feature is intended to help in two respects:

  1. An alias name is limited in length only by available memory, not by your filesystem. Therefore, if you want to ask for ‘Adobe-Lucida-Bold-Sans=Typewriter’ instead of ‘plcbst’, you can.
  2. A few fonts have historically had multiple names: specifically, LaTeX’s “circle font” has variously been known as ‘circle10’, ‘lcircle10’, and ‘lcirc10’. Aliases can make all the names equivalent, so that it no longer matters what the name of the installed file is; TeX documents will find their favorite name.

The format of fontmap files is straightforward: the first word on each line is the true filename; the second word is the alias; subsequent words are ignored. A word is a sequence of non-whitespace characters. Blank lines are ignored; comments start with ‘%’ and continue to end-of-line.

If an alias has an extension, it matches only those files with that extension; otherwise, it matches anything with the same root, regardless of extension. For example, an alias ‘foo.tfm’ matches only when exactly ‘foo.tfm’ is being searched for; but an alias ‘foo’ matches ‘foo.vf’, ‘foo.300pk’, etc.

As an example, here are the fontmap entries that make the circle fonts equivalent. These are in the distributed ‘texfonts.map’ in the Web2C distribution.

circle10	lcircle10
circle10	lcirc10
lcircle10	circle10
lcircle10	lcirc10
lcirc10		circle10
lcirc10		lcircle10

[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.2.3 ‘MakeTeX’… scripts

If Kpathsea cannot find a bitmap font, by either its original name or a fontmap alias, it can be configured to invoke an external program to create it. The same mechanism can be used for other nonexistent files.

The script is passed the name of the file to create and possibly other arguments, as explained below. It must echo the full pathname of the file it created (and nothing else) to standard output; it can write diagnostics to standard error.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.2.3.1 ‘MakeTeX’… script names

The following table shows the default name of the script for each possible file types. (The source is the variable kpse_make_specs in ‘kpathsea/tex-make.c’.)

MakeTeXPK

Glyph fonts.

MakeTeXTeX

TeX input files.

MakeTeXMF

Metafont input files.

MakeTeXTFM

TFM files.

These names are overridden by an environment variable specific to the program—for example, ‘DVIPSMAKEPK’ for Dvipsk.

If a MakeTeX… script fails, the invocation is appended to a file ‘missfont.log’ in the current directory. If the current directory is not writable and the environment variable ‘TEXMFOUTPUT’ is set, its value is used. Otherwise, nothing is written.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.2.3.2 ‘MakeTeX’… script arguments

The first argument to a ‘MakeTeX’… script is always the name of the file to be created.

For ‘MakeTeXPK’, three or four additional arguments are also passed, via corresponding environment variables:

  1. The dpi to make the font at (‘KPATHSEA_DPI’).
  2. The “base dpi” the program is operating at (‘MAKETEX_BASE_DPI’), i.e., the assumed resolution of the output device.
  3. A “magstep” string suitable for the Metafont mag variable (‘MAKETEX_MAG’).
  4. Optionally, a Metafont mode name to assign to the Metafont mode variable (‘MAKETEX_MODE’). Otherwise, (the default) MakeTeXPK guesses the mode from the resolution. See section TeX directory structure.
  5. Optionally, a directory name. If the directory is absolute, it is used as-is. Otherwise, it is appended to the root destination directory set in the script (from environment variables DESTDIR or MTP_DESTDIR or a compile-time default). If this argument is not supplied, the mode name is appended to the root destination directory.

Kpathsea sets ‘KPATHSEA_DPI’ appropriately for each attempt at building a font. It’s up to the program using Kpathsea to set the others. (See section Calling sequence.)

You can change the specification for the arguments passed to the external script by setting the environment variable named as the script name, but all capitals—‘MAKETEXPK’, for example. If you’ve changed the script name by setting (say) ‘DVIPSMAKEPK’ to ‘foo’, then the spec is taken from the environment variable ‘FOO’.

The spec can contain any variable references, to the above variables or any others you might have set. As an example, the default spec for MakeTeXPK is:

$KPATHSEA_DPI $MAKETEX_BASE_DPI $MAKETEX_MAG $MAKETEX_MODE

The convention of passing the name of the file to be created as the first argument cannot be changed.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.2.4 Fallback font

If a bitmap font cannot be found or created at the requested size, Kpathsea looks for the font at a set of fallback resolutions. You specify these resolutions as a colon-separated list (like search paths). Kpathsea looks first for a program-specific environment variable (e.g., DVIPSSIZES for Dvipsk), then the environment variable ‘TEXSIZES’, then a default specified at compilation time (the Make variable default_texsizes). You can set this list to be empty if you prefer to find fonts at their stated size or not at all.

Finally, if the font cannot be found even at the fallback resolutions, Kpathsea looks for a fallback font, typically ‘cmr10’. Programs must enable this feature by assigning to the global variable kpse_fallback_font or calling kpse_init_prog (see section Calling sequence); the default is no such fallback font.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6 TeX directory structure

(This section obviously not really written yet; sorry. See ‘kpathsea/HIER’.)

By default, the bitmap font paths end with $MAKETEX_MODE, thus including the device name (i.e., the Metafont mode) in the path. This is to make it possible to distinguish two different devices with the same resolution—write/white and write/black 300dpi printers, for example.

However, since most sites don’t have this complication, Kpathsea (specifically, kpse_init_prog in ‘kpathsea/proginit.c’) has a special case: if the mode has not been explicitly set by the user (or in a configuration file), it sets ‘MAKETEX_MODE’ to /. This makes the default PK path, for example, expand into …/pk//, so fonts will be found even if there is no subdirectory for the mode. (If your site has only one printer, for example.)

To make the paths independent of the mode, simply edit ‘texmf.cnf.in’ before installation, or the installed ‘texmf.cnf’. See section Default paths.

See section MakeTeX’… script arguments, for how this interacts with MakeTeXPK.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7 Programming

This chapter is for programmers who wish to use Kpathsea. See section Introduction, for the conditions under which you may do so. (If you do this, I’d appreciate a note, just to satisfy my curiousity.)


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.1 Programming overview

Aside from this manual, your best source of information is the source to the programs I’ve modified to use Kpathsea (also listed in the introduction). Of those, Dviljk is probably the simplest, and hence a good place to start. Xdvik adds VF support and the complication of X resources. Dvipsk adds the complication of its own config files.

Beyond these of examples of use, the ‘.h’ files in the Kpathsea source describe the interfaces and functionality (and of course the ‘.c’ files define the actual routines, which are the ultimate documentation). ‘pathsearch.h’ declares the basic searching routine. ‘tex-file.h’ and ‘tex-glyph.h’ define the interfaces for looking up particular kinds of files.

The library provides no way for an external program to register new file types: ‘tex-file.[ch]’ must be modified to do this. For example, Kpathsea has support for looking up Dvips config files, even though obviously no program other than Dvips will ever want to do so. I felt this was acceptable, since along with new file types should also come new defaults in ‘texmf.cnf’ (and its descendant ‘paths.h’), since it’s best for users if they can modify one configuration file for all kinds of paths.

Kpathsea does not open any files or parse any formats itself. Its purpose is only to return filenames. The GNU font utilities source does contain libraries to read TFM, GF, and PK files.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.2 Calling sequence

The typical way to use Kpathsea in your program goes something like this:

  1. Call kpse_set_progname with argv[0]; This is the only initialization that is mandatory to take full advantage of Kpathsea—specifically, for the .program feature of config files (see section Config files).

    kpse_set_progname sets the global variables program_invocation_name and program_invocation_short_name. It also initializes debugging flags based on the environment variable KPATHSEA_DEBUG, if that is set. set.

    The GNU C library provides these two global variables itself; in this case, the call to kpse_set_program does nothing. But you (as a software author) most likely do not want to force people installing your program to have glibc.

  2. Set debugging options. See section Debugging. If your program doesn’t have a debugging flag already, you can define one and set ‘kpathsea_debug’ to the number that the user supplies (see Dviljk), or you can just omit this altogether (people can always set ‘KPATHSEA_DEBUG’). If you do have runtime debugging already, you need to merge Kpathsea’s options with yours (see Dvipsk and Xdvik).
  3. If your program has its own configuration files that can define search paths, you should assign those paths to the client_path member in the appropriate element of the ‘kpse_format_info’ array. (This array is indexed by file type; see ‘tex-file.h’.) See ‘resident.c’ in Dvipsk for an example.
  4. Call kpse_init_prog (see ‘proginit.c’). It’s useful for the DVI drivers, at least, but for other programs it may be simpler to extract the parts of it that actually apply. This does not initialize any paths, it just looks for (and sets) certain environment variables and other random information. (A search path is always initialized at the first call to find a file of that type; this eliminates much useless work, e.g., initializing the BibTeX search paths in a DVI driver.)
  5. The routine to actually find a file of type format is kpse_find_format, defined in ‘tex-file.h’. These are macros that expand to a call to ‘kpse_find_file’. You can call, say, kpse_find_tfm after doing only the first of the initialization steps above—Kpathsea will read the generic config file ‘texmf.cmf’, look for environment variables, and do the expansions at the first lookup.
  6. To find PK and/or GF bitmap fonts, the routines are ‘kpse_find_pk’, ‘kpse_find_gf’ and ‘kpse_find_glyph’, defined in ‘tex-glyph.h’. These return a structure in addition to the resultant filename, because fonts can be found in so many ways. See the documentation in the source.

Kpathsea also provides many utility routines. Some are generic: hash tables, memory allocation, string concatenation and copying, string lists, reading input lines of unlimited length, etc. Others are filename-related: default path, tilde, and variable expansion, stat calls, etc. (Perhaps someday I’ll move the former to a separate library.)

The ‘c-*.h’ header files can also help your program adapt to many different systems. You will almost certainly want to use Autoconf for configuring your software if you use Kpathsea; I strongly recommend using Autoconf regardless. You can get it by ftp from ‘prep.ai.mit.edu’ in ‘pub/gnu/autoconf-*.tar.gz’, or from any of its mirrors.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.3 Programming with config files

You can use the same texmf.cnf configuration file as Kpathsea for your program. This will help installers do all configuration in one place.

To retrieve a value var, the best way is to call kpse_var_expand on the string $var. This will look first for an environment variable var, then a config file value. The result will be the value found, or the empty string. This function is declared in ‘kpathsea/variable.h’.

If for some reason you want to retrieve a value only from a config file, not automatically looking for a corresponding environment variable, call kpse_cnf_get (declared in ‘kpathsea/cnf.h’) with the string var.

No initialization calls are needed.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Index

Jump to:   !   $   -   .   /   :   ~  
A   B   C   D   E   F   G   H   I   K   L   M   N   O   P   Q   R   S   T   U   V   W   X   Z  
Index Entry  Section

!
!! in path specifications 4.7 Filename database (ls-R)

$
$ 4.4 Variable expansion
$HOME’ searching caveat 2.2.2 Slow path searching

-
-L option to ls 4.7 Filename database (ls-R)
-static 2.2.5 ShellWidgetClass

.
.base 5.1 TeX environment variables
.bib 5.1 TeX environment variables
.bst 5.1 TeX environment variables
.cnf 5.1 TeX environment variables
.eps 5.1 TeX environment variables
.fmt 5.1 TeX environment variables
.gf 5.1 TeX environment variables
.mf 5.1 TeX environment variables
.pict 5.1 TeX environment variables
.pk 5.1 TeX environment variables
.pool 5.1 TeX environment variables
.pool 5.1 TeX environment variables
.tex 5.1 TeX environment variables
.tfm 5.1 TeX environment variables
.vf 5.1 TeX environment variables

/
/ may not be / 4.1 Searching overview
// 4.6 Subdirectory expansion

:
: may not be : 4.1 Searching overview
:: 4.3 Default expansion

~
~ 4.5 Tilde expansion
~’ searching caveat 2.2.2 Slow path searching

A
absolute filenames 4.1 Searching overview
aliases for fonts 5.2.2 Fontmap
Alpha OSF/1 loader bug and XtInherit 2.2.3 XtInherit
arguments to ‘MakeTeX’… 5.2.3.2 ‘MakeTeX’… script arguments
argv[0] 7.2 Calling sequence

B
base dpi 5.2.3.2 ‘MakeTeX’… script arguments
basic glyph lookup 5.2.1 Basic glyph lookup
BIBINPUTS 5.1 TeX environment variables
BSTINPUTS 5.1 TeX environment variables
bug address 2.4 Reporting bugs
bugs, reporting 2.4 Reporting bugs

C
c-*.h 7.2 Calling sequence
calling sequence 7.2 Calling sequence
cc warnings 2.2.6 Pointer combination warnings
circle fonts 5.2.2 Fontmap
client_path in kpse_format_info 7.2 Calling sequence
cmr10 5.2.4 Fallback font
cnf.c 4.2.1 Config files
cnf.h 7.3 Programming with config files
comments, in ‘texmf.cnf 4.2.1 Config files
common features in glyph lookup 5.2.1 Basic glyph lookup
comp.sys.sun.admin FAQ 2.2.5 ShellWidgetClass
compilation 2 Installation
compilation value, source for path 4.2 Path sources
conditions for use 1 Introduction
config files 4.2.1 Config files
config files, for kpathsea-using program 7.2 Calling sequence
config files, programming with 7.3 Programming with config files
configuration 2 Installation
configuration file, source for path 4.2 Path sources
configuration files as shell scripts. 4.2.1 Config files
cron and ‘ls-R 4.7 Filename database (ls-R)

D
database for filename searches 4.7 Filename database (ls-R)
database search 4.1 Searching overview
database, format of 4.7.1 Database format
debug.h 3 Debugging
debugging 3 Debugging
debugging flags, in kpathsea-using program 7.2 Calling sequence
default expansion 4.3 Default expansion
default paths, changing 2.1 Default paths
default paths, how they’re made 2.1 Default paths
default_texsizes 5.2.4 Fallback font
destination directory for MakeTeXPK 5.2.3.2 ‘MakeTeX’… script arguments
directories, changing default installation 2.1 Default paths
disk search 4.1 Searching overview
doubled colons 4.3 Default expansion
DVILJMAKEPK 5.2.3.1 ‘MakeTeX’… script names
DVILJSIZES 5.2.4 Fallback font
DVIPSFONTS 5.1 TeX environment variables
DVIPSMAKEPK 5.2.3.1 ‘MakeTeX’… script names
DVIPSSIZES 5.2.4 Fallback font
dynamic linking problems with openwin libraries 2.2.5 ShellWidgetClass

E
elt-dirs.c 4.6 Subdirectory expansion
environment variable, source for path 4.2 Path sources
environment variables for TeX 5.1 TeX environment variables
environment variables in paths 4.4 Variable expansion
epoch 3.1 Logging
excessive startup time 2.2.2 Slow path searching
exec_prefix, changing 2.1 Default paths
expansion of path elements 4.1 Searching overview
expansion, default 4.3 Default expansion
expansion, subdirectory 4.6 Subdirectory expansion
expansion, tilde 4.5 Tilde expansion
expansion, variable 4.4 Variable expansion
explicitly relative filenames 4.1 Searching overview
externally-built filename database 4.7 Filename database (ls-R)
extra colons 4.3 Default expansion

F
failed MakeTeX… 5.2.3.1 ‘MakeTeX’… script names
fallback font 5.2.4 Fallback font
fallback resolutions 5.2.4 Fallback font
FAQ, ‘comp.sys.sun.admin 2.2.5 ShellWidgetClass
filename database 4.7 Filename database (ls-R)
filenames, absolute or explicitly relative 4.1 Searching overview
files, unable to find 2.2.1 Unable to find files
filesystem search 4.1 Searching overview
floating directories 4.1 Searching overview
FOIL_X_WCHAR_T 2.2.4 wchar_t
font alias files 5.2.2 Fontmap
font of last resort 5.2.4 Fallback font
fontmap files 5.2.2 Fontmap
fontnames, unlimited length 5.2.2 Fontmap
format of external database 4.7.1 Database format
fundamental purpose 1 Introduction

G
get_applicationShellWidgetClass 2.2.5 ShellWidgetClass
get_wmShellWidgetClass 2.2.5 ShellWidgetClass
GFFONTS 5.1 TeX environment variables
glyph lookup 5.2 Glyph lookup
glyph lookup bitmap tolerance 5.2.1 Basic glyph lookup
GLYPHFONTS 5.1 TeX environment variables
GLYPHFONTS 5.1 TeX environment variables
GNU C library 7.2 Calling sequence
GNU General Public License 1 Introduction
GNU Library General Public License 1 Introduction

H
hash table routines 7.2 Calling sequence
HIER 2.1 Default paths
history of Kpathsea 1.1 History
home directories in paths 4.5 Tilde expansion

I
illegal pointer combination warnings 2.2.6 Pointer combination warnings
input lines, reading 7.2 Calling sequence
installation 2 Installation
installation directories, changing default 2.1 Default paths
interface, not frozen 1 Introduction
introduction 1 Introduction

K
kdebug: 3 Debugging
Knuth, Donald E. 1.1 History
Kpathsea config file, source for path 4.2 Path sources
kpathsea/HIER 2.1 Default paths
kpathsea/proginit.c 6 TeX directory structure
kpathsea_debug 3 Debugging
KPATHSEA_DEBUG 3 Debugging
KPATHSEA_DEBUG 7.2 Calling sequence
kpathsea_debug 7.2 Calling sequence
KPATHSEA_DPI 5.2.3.2 ‘MakeTeX’… script arguments
KPSE_BITMAP_TOLERANCE 5.2.1 Basic glyph lookup
kpse_cnf_get 7.3 Programming with config files
KPSE_DEBUG_EXPAND 3 Debugging
KPSE_DEBUG_FOPEN 3 Debugging
KPSE_DEBUG_HASH 3 Debugging
KPSE_DEBUG_PATHS 3 Debugging
KPSE_DEBUG_SEARCH 3 Debugging
KPSE_DEBUG_STAT 3 Debugging
kpse_fallback_font 5.2.4 Fallback font
kpse_find_* 7.2 Calling sequence
kpse_find_glyph_format 5.2 Glyph lookup
kpse_format_info 7.2 Calling sequence
kpse_init_prog 6 TeX directory structure
kpse_init_prog 7.2 Calling sequence
kpse_make_specs 5.2.3.1 ‘MakeTeX’… script names
kpse_set_progname 7.2 Calling sequence
kpse_var_expand 7.3 Programming with config files

L
last-resort font 5.2.4 Fallback font
lcircle10 5.2.2 Fontmap
leading colons 4.3 Default expansion
leaf directories wrongly guessed 2.2.1 Unable to find files
leaf directory trick 4.6 Subdirectory expansion
license for using the library 1 Introduction
lines, reading unlimited-length 7.2 Calling sequence
log file 3.1 Logging
ls-R database file 4.7 Filename database (ls-R)

M
mag Metafont variable 5.2.3.2 ‘MakeTeX’… script arguments
magic characters 4.1 Searching overview
magstep for MakeTeXPK 5.2.3.2 ‘MakeTeX’… script arguments
MakeTeX’… script names 5.2.3.1 ‘MakeTeX’… script names
MakeTeX’… scripts 5.2.3 ‘MakeTeX’… scripts
MakeTeXMF 5.2.3.1 ‘MakeTeX’… script names
MakeTeXPK 5.2.3.1 ‘MakeTeX’… script names
MAKETEXPK environment variable 5.2.3.2 ‘MakeTeX’… script arguments
MakeTeXTeX 5.2.3.1 ‘MakeTeX’… script names
MakeTeXTFM 5.2.3.1 ‘MakeTeX’… script names
MAKETEX_BASE_DPI 5.2.3.2 ‘MakeTeX’… script arguments
MAKETEX_MAG 5.2.3.2 ‘MakeTeX’… script arguments
MAKETEX_MODE 5.2.3.2 ‘MakeTeX’… script arguments
MAKETEX_MODE 6 TeX directory structure
memory allocation routines 7.2 Calling sequence
Metafont mode name for MakeTeXPK 5.2.3.2 ‘MakeTeX’… script arguments
MFBASES 5.1 TeX environment variables
MFINPUTS 5.1 TeX environment variables
MFPOOL 5.1 TeX environment variables
missfont.log 5.2.3.1 ‘MakeTeX’… script names
mode Metafont variable 5.2.3.2 ‘MakeTeX’… script arguments
Morgan, Tim 1.1 History
mtp_destdir 5.2.3.2 ‘MakeTeX’… script arguments

N
names for ‘MakeTeX’… scripts 5.2.3.1 ‘MakeTeX’… script names
Neumann, Gustaf 1.1 History

O
openwin libraries, dynamic linking problems 2.2.5 ShellWidgetClass
options for debugging 3 Debugging
OSF/1 loader bug and XtInherit 2.2.3 XtInherit
overview of path searching 4.1 Searching overview
overview of programming with Kpathsea 7.1 Programming overview

P
path searching 4 Path searching
path searching, overview 4.1 Searching overview
path sources 4.2 Path sources
paths, changing default 2.1 Default paths
paths, device name included in 6 TeX directory structure
paths.h 2.1 Default paths
pathsearch.h 7.1 Programming overview
PKFONTS 5.1 TeX environment variables
pointer combination warnings 2.2.6 Pointer combination warnings
prefix, changing 2.1 Default paths
proginit.c 6 TeX directory structure
proginit.h 7.2 Calling sequence
programming overview 7.1 Programming overview
programming with config files 7.3 Programming with config files
programming with Kpathsea 7.2 Calling sequence
programs using the library 1 Introduction
program_invocation_name 7.2 Calling sequence
program_invocation_short_name 7.2 Calling sequence

Q
quoting variable values 4.4 Variable expansion

R
reading unlimited-length lines 7.2 Calling sequence
recording successful searches 3.1 Logging
recursion from ‘/ 2.2.2 Slow path searching
relative filenames 4.1 Searching overview
reporting bugs 2.4 Reporting bugs
resident.c 7.2 Calling sequence
resolutions, last-resort 5.2.4 Fallback font
Rokicki, Tom 1.1 History
root’ searching peculiarities 2.2.2 Slow path searching
runtime configuration files 4.2.1 Config files
runtime debugging 3 Debugging

S
scripts for file creation 5.2.3 ‘MakeTeX’… scripts
search path, defined 4.1 Searching overview
searching for glyphs 5.2 Glyph lookup
searching overview 4.1 Searching overview
searching the database 4.1 Searching overview
searching the disk 4.1 Searching overview
shared library, making 2.3 Shared library
shell scripts as configuration files 4.2.1 Config files
shell variables 4.4 Variable expansion
slow startup time 2.2.2 Slow path searching
sources for search paths 4.2 Path sources
specification for MakeTeXPK 5.2.3.2 ‘MakeTeX’… script arguments
startup time, excessive 2.2.2 Slow path searching
static linking 2.2.5 ShellWidgetClass
string routines 7.2 Calling sequence
st_nlink 4.6 Subdirectory expansion
subdirectory searching 4.6 Subdirectory expansion
Sun openwin patches 2.2.5 ShellWidgetClass
symbolic links not found 2.2.1 Unable to find files
symbolic links, and ‘ls-R 4.7 Filename database (ls-R)

T
TeX environment variables 5.1 TeX environment variables
TeX glyph lookup 5.2 Glyph lookup
TeX searching 5 TeX searching
TeX Users Group 1 Introduction
tex-file.h 7.1 Programming overview
tex-glyph.c 5.2 Glyph lookup
tex-glyph.h 7.1 Programming overview
tex-k@cs.umb.edu (bug address) 2.4 Reporting bugs
tex-make.c 5.2.3.1 ‘MakeTeX’… script names
TEXFONTS 5.1 TeX environment variables
TEXFONTS 5.1 TeX environment variables
TEXFONTS 5.1 TeX environment variables
TEXFONTS 5.1 TeX environment variables
texfonts.map 5.2.2 Fontmap
TEXFORMATS 5.1 TeX environment variables
TEXINPUTS 5.1 TeX environment variables
TEXINPUTS 5.1 TeX environment variables
TEXINPUTS 5.1 TeX environment variables
TEXMF 6 TeX directory structure
texmf.cnf definition 4.2.1 Config files
texmf.cnf, and variable expansion 4.4 Variable expansion
texmf.cnf, generated 2.1 Default paths
texmf.cnf, source for path 4.2 Path sources
texmf.cnf.in 2.1 Default paths
texmf.sed 2.1 Default paths
TEXMFCNF 4.2.1 Config files
TEXMFCNF 5.1 TeX environment variables
TEXMFLOG 3.1 Logging
TEXMFOUTPUT 5.2.3.1 ‘MakeTeX’… script names
TEXPICTS 5.1 TeX environment variables
TEXPKS 5.1 TeX environment variables
TEXPOOL 5.1 TeX environment variables
TEXSIZES 5.2.4 Fallback font
TFMFONTS 5.1 TeX environment variables
tilde expansion 4.5 Tilde expansion
time 3.1 Logging
tolerance for glyph lookup 5.2.1 Basic glyph lookup
trailing colons 4.3 Default expansion
trick for detecting leaf directories 4.6 Subdirectory expansion
tug@tug.org 1 Introduction

U
unable to find files 2.2.1 Unable to find files
UNIX_ST_LINK 4.6 Subdirectory expansion

V
variable expansion 4.4 Variable expansion
variable.h 7.3 Programming with config files
VFFONTS 5.1 TeX environment variables
Vojta, Paul 1.1 History

W
Walsh, Norman 1.1 History
warning about unusable ‘ls-R 4.7 Filename database (ls-R)
warnings, pointer combinations 2.2.6 Pointer combination warnings
wchar_t 2.2.4 wchar_t

X
XDVIFONTS 5.1 TeX environment variables
XDVIMAKEPK 5.2.3.1 ‘MakeTeX’… script names
XDVISIZES 5.2.4 Fallback font
Xlib.h 2.2.4 wchar_t
Xmu library problems 2.2.5 ShellWidgetClass
XtInherit bug on OSF/1 2.2.3 XtInherit

Z
zuhn, david 1.1 History

Jump to:   !   $   -   .   /   :   ~  
A   B   C   D   E   F   G   H   I   K   L   M   N   O   P   Q   R   S   T   U   V   W   X   Z  

[Top] [Contents] [Index] [ ? ]

Table of Contents


[Top] [Contents] [Index] [ ? ]

About This Document

This document was generated on November 10, 2022 using texi2html 5.0.

The buttons in the navigation panels have the following meaning:

Button Name Go to From 1.2.3 go to
[ << ] FastBack Beginning of this chapter or previous chapter 1
[ < ] Back Previous section in reading order 1.2.2
[ Up ] Up Up section 1.2
[ > ] Forward Next section in reading order 1.2.4
[ >> ] FastForward Next chapter 2
[Top] Top Cover (top) of document  
[Contents] Contents Table of contents  
[Index] Index Index  
[ ? ] About About (help)  

where the Example assumes that the current position is at Subsubsection One-Two-Three of a document of the following structure:


This document was generated on November 10, 2022 using texi2html 5.0.